package com.zdj.websocket.controller.v3;

import com.zdj.websocket.model.InMessage;
import com.zdj.websocket.service.WebSocketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.stereotype.Controller;

/**
 * @author zhangdj
 */
@Controller
public class SingleChatController {

    @Autowired
    private WebSocketService service;

    @MessageMapping("/v3/single/chat")
    public void sendSingle(InMessage inMessage) {
        service.sendSingle("/chat/single/" + inMessage.getTo(), inMessage);
        service.sendSingle("/chat/single/" + inMessage.getFrom(), inMessage);
    }
}
